export function shuffle (source) {
  const arr = source.slice()
  for (let i = 0; i < arr.length; i++) {
    const j = getRandomInit(i)
    swap(arr, i, j)
  }
  return arr
}
function getRandomInit (max) {
  // 0-max
  return Math.floor(Math.random() * (max + 1))
}
function swap (arr, i, j) {
  const t = arr[i]
  arr[i] = arr[j]
  arr[j] = t
}
export function formatTime (interval) {
  // interval: 30 返回 00:30
  // interval: 125 返回 02:05
  // |0 强转成整数
  interval = interval | 0
  // 除以60再转整数
  const minute = (((interval / 60) | 0) + '').padStart(2, '0')
  const second = ((interval % 60) + '').padStart(2, '0')
  return `${minute}:${second}`
}
